using Tatibah;

namespace HeaderFooterDifferentFirstPage
{
	// See the DocumetAPI.PDF for the results
    class Program
	{
		static void Main(string[] args)
		{
			// Create the document
            Document document = new Document(@"C:\Tatibah\Results\HeaderFooterDifferentFirstPage.docx");

			// Create a Footer for the first page. Create a Header and Footer for all other pages
            Header otherPageHeader = new Header(new Paragraph("This is Other Page Header"));
			Footer firstPageFooter = new Footer(new Paragraph("This is the First Page Footer"));
			Footer otherPageFooter = new Footer(new Paragraph("This is the Other Page Footer"));

			// Add the Headers and Footers to the document.
			// Note the First Page Header is null so there will be no Header for the First Page
            document.Append(null, otherPageHeader, firstPageFooter, otherPageFooter);

            // Add title page
            document.Append(
                new Paragraph("Title Page")
                {
                    Alignment = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Center,
                    FontSize = 24.5
                },
                new Paragraph("Has no Header") { Alignment = DocumentFormat.OpenXml.Wordprocessing.JustificationValues.Center }
            );

            // Add some more content and force a Page Break
            document.Append(new Paragraph(
                "No one would have believed in the last years of the nineteenth " +
                "century that this world was being watched keenly and closely by " +
                "intelligences greater than man's and yet as mortal as his own; that as " +
                "men busied themselves about their various concerns they were " +
                "scrutinised and studied, perhaps almost as narrowly as a man with a " +
                "microscope might scrutinise the transient creatures that swarm and " +
                "multiply in a drop of water."
            ) { PageBreakBefore = true });

            // Save the Document
            document.Save();
            document.Close();
        }
    }
}
